﻿Imports DevComponents.DotNetBar
Public Class frmMain
    Dim ctrlBangXH As UC_BangXepHang
    Dim ctrlCauThu As UC_CauThu1
    Dim ctrlCauLacBo As UC_CauLacBo
    Dim ctrlGhiBan As UC_GhiBan
    Dim ctrlQT As UC_QuocTich
    Dim ctrlTranDau As UC_TranDau
    Dim ctrlHome As UC_Home

    Private Sub btBXH_Click(sender As Object, e As EventArgs) Handles btBXH.Click
        pnMain.Controls.Clear()

        If ctrlBangXH Is Nothing Then
            ctrlBangXH = New UC_BangXepHang
            pnMain.Controls.Add(ctrlBangXH)
        End If
    End Sub

    Private Sub btCLB_Click(sender As Object, e As EventArgs) Handles btCLB.Click
        pnMain.Controls.Clear()

        If ctrlCauLacBo Is Nothing Then
            ctrlCauLacBo = New UC_CauLacBo
            pnMain.Controls.Add(ctrlCauLacBo)
        End If
    End Sub

    Private Sub btCT_Click(sender As Object, e As EventArgs) Handles btCT.Click
        pnMain.Controls.Clear()

        If ctrlCauThu Is Nothing Then
            ctrlCauThu = New UC_CauThu1
            pnMain.Controls.Add(ctrlCauThu)
        End If
    End Sub

    Private Sub btGB_Click(sender As Object, e As EventArgs) Handles btGB.Click
        pnMain.Controls.Clear()

        If ctrlGhiBan Is Nothing Then
            ctrlGhiBan = New UC_GhiBan
            pnMain.Controls.Add(ctrlGhiBan)
        End If
    End Sub

    Private Sub btQT_Click(sender As Object, e As EventArgs) Handles btQT.Click
        pnMain.Controls.Clear()

        If ctrlQT Is Nothing Then
            ctrlQT = New UC_QuocTich
            pnMain.Controls.Add(ctrlQT)
        End If
    End Sub

    Private Sub btTD_Click(sender As Object, e As EventArgs) Handles btTD.Click
        pnMain.Controls.Clear()

        If ctrlTranDau Is Nothing Then
            ctrlTranDau = New UC_TranDau
            pnMain.Controls.Add(ctrlTranDau)
        End If
    End Sub

    Private Sub btHome_Click(sender As Object, e As EventArgs) Handles btHome.Click
        pnMain.Controls.Clear()
        If ctrlHome Is Nothing Then
            ctrlHome = New UC_Home
            pnMain.Controls.Add(ctrlHome)
        End If
    End Sub


    Private Sub btThem_Click(sender As Object, e As EventArgs) Handles btThem.Click
        If pnMain.Controls.Count = 0 Then
            MessageBoxEx.Show("Khôn có dữ liệu để thực hiện.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return
        End If

        Dim ctrl As IDaTa = CType(pnMain.Controls(0), IDaTa)
        ctrl.Them()
    End Sub

    Private Sub btXoa_Click(sender As Object, e As EventArgs) Handles btXoa.Click
        If pnMain.Controls.Count = 0 Then
            MessageBoxEx.Show("Khôn có dữ liệu để thực hiện.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return
        End If
        Dim ctrl As IDaTa = CType(pnMain.Controls(0), IDaTa)
        ctrl.Xoa()
    End Sub

    Private Sub ButtonItem16_Click(sender As Object, e As EventArgs) Handles ButtonItem16.Click
        If pnMain.Controls.Count = 0 Then
            MessageBoxEx.Show("Khôn có dữ liệu để thực hiện.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Return
        End If

        Dim ctrl As IDaTa
        ctrl = CType(pnMain.Controls(0), IDaTa)
        ctrl.CapNhat()
    End Sub
End Class